import React, { Component } from 'react'
import styles from "../assets/styles/itemlist.module.css"

export default class ItemList extends Component {
    render() {
        const { lists } = this.props
        return (
            <div className={styles.list}>
                {lists.map(item => {
                    return (
                        <div className={styles.box}>
                            <div style={{height:"200px",overflow:"hidden"}}>
                                <img width={"100%"} src={item.imgSrc} alt="" />
                            </div>
                            <p>{item.name}</p>
                            <p>{item.title}</p>
                            <button onClick={()=>this.props.addShopCar(item.id)}>加入购物车</button>
                        </div>
                    )
                })}
            </div>
        )
    }
}
